package com.yantong.mapper;

import com.yantong.pojo.ChooseProductRes;
import com.yantong.pojo.Product;
import com.yantong.pojo.vo.ProductVo;
import com.yantong.pojo.vo.StaticVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface ProductMapper {
	List<Product> list(HashMap<String, Object> map, RowBounds rowBounds);
	List<Product> list(HashMap<String, Object> map);
	long count(HashMap<String, Object> map);

    long listBaseProductCount(HashMap<String, Object> map);
    List<Product> listBaseProduct(HashMap<String, Object> map, RowBounds rowBounds);
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int insert(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int insertSelective(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    Product selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int updateByPrimaryKeySelective(Product record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table t_product_base
     *
     * @mbg.generated Sun Sep 09 08:58:04 CST 2018
     */
    int updateByPrimaryKey(Product record);

    /**
     * 更新库存
     * @param total
     * @param pid
     * @param version
     * @return
     */
    int changeStock(@Param("nums") int total, @Param("pid") Long pid, @Param("version") Integer version);

    /**
     * 退回库存
     * @param total
     * @param pid
     * @param version
     * @return
     */
    int refundStock(@Param("nums") int total, @Param("pid") Long pid, @Param("version") Integer version);
    /**
     * 通过包含主键的Map更新平台商品库中表字段
     * 如需更新更新字段修改Mapper
     * @param updMap
     * @return
     */
	int changeBaseProductByIdMap(Map<Object, Object> updMap);

	/**
	 * 得到生活专区下面的商户商品
	 * @return
	 */
	List<Product> getProductBaseByCate();

//	/**
//	 * 导出功能数据列表
//	 * @param map
//	 * @param rowBounds
//	 * @return
//	 */
//	List<ProductVo> getExprotProductlist(HashMap<String, Object> map);

	StaticVo sumcostprice(HashMap<String, Object> map);

	/**
	 * 得到Id
	 * @return
	 */
	Long getId();

	/**
	 * 得到商品
	 * @return
	 */
	Product getProduct(Long id);


	/**
	 * 选择商品查询
	 * @param map
	 * @param rowBounds
	 * @return
	 */
	List<ChooseProductRes> chooseProductList(Map<String, Object> map, RowBounds rowBounds);
	long chooseProductCount(Map<String, Object> map);


	/**
	 * 导出功能数据列表
	 * @param map
	 * @param rowBounds
	 * @return
	 */
	List<ProductVo> getExprotProductlist(HashMap<String,Object> map);
}